package com.golxen.framework.common.server.game.dao;

import com.golxen.framework.db.DBManager;
import com.golxen.framework.db.dao.AbstractDaoImpl;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.HashMap;

public class GameConfigParamDaoImpl extends AbstractDaoImpl {
    public HashMap<String, String> getGameConfig(){
        HashMap<String, String> allConfigs=new HashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sql = "select * from t_p_param";
        try {
            getDb().setConnName(DBManager.configDbName);
            call = getDb().getConnection().prepareCall(sql);
            rs = call.executeQuery();
            while (rs.next()) {
               allConfigs.put(rs.getString("param"),rs.getString("value"));
            }
            return allConfigs;
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            getDb().closeConnection(call, rs);
        }
    }
}
